package spring.cloud.chapter2.controller;

//import io.github.yedaxia.apidocs.ApiDoc;
//import io.github.yedaxia.apidocs.Ignore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * 页面访问接口
 */
@Api(tags = "页面访问接口")
@Controller
@RequestMapping("/chapter2")
public class PageController {


    /**
     * 首页访问
     * @param value 传递的value值
     * @return
     */
//    @ApiDoc(result = String.class)
    @ApiOperation(value="首页访问",notes = "首页跳转的页面")
    @ApiImplicitParam(name = "value",value = "向页面传递的value值",required = true,dataType = "string",paramType = "path",example = "index")
    @GetMapping("/index/{value}")
    public ModelAndView index(ModelAndView mav, @PathVariable("value") String value){
        mav.getModelMap().addAttribute("key",value);
        mav.setViewName("index");

        return mav;
    }
}
